
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>档案管理</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js" type="text/javascript"></script>
<script src="libs/getQueryString.js" type="text/javascript"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h1 align="center">
					<strong>档案管理</strong>
					</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-8">
				<ul class="nav nav-pills">
					<li class="active"><a href="index.html">首页</a></li>
					<li><a href="add_Archive.html"><strong>添加信息</strong></a></li>

					<li><a href="querymh.html"><strong>查询</strong></a></li>

					<li><a href="login.html"><strong>用户：</strong><span
							id="text"></span></a></li>
				</ul>
			</div>
			<div class="col-md-offset-8">
				<ul class="nav nav-pills">
					<li>
						<div className="input-group">
							<input className="for_control" id="search-box-value"
								placeholder="档案号或身份证号" type="text" /> <span
								className="input-group-btn">
								<button className="btn btn-default" id="search" type=button>
									<i className="fa fa-search">搜索</i>
								</button>
							</span>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<hr />
			</div>
		</div>
	</div>
	<div class="container">
		<!-- Nav tabs -->
		<ul class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home"
				aria-controls="home" role="tab" data-toggle="tab">信息</a></li>
			<li role="presentation"><a href="#profile"
				aria-controls="profile" role="tab" data-toggle="tab">照片</a></li>
			<li role="presentation"><a href="#messages"
				aria-controls="messages" role="tab" data-toggle="tab">上传</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div role="tabpanel" class="tab-pane active" id="home">
				<div class="panel-body" id="list1">
					<div class="container">
						<h3>
							<div class="row">
								<div class="col-md-6">
									<table border="2px">

										<tr>
											<td><strong>档案号：</strong></td>
											<td><input id="text1" readonly="readonly" /></td>
										</tr>
										<tr>
											<td><strong>身份证号：</strong></td>
											<td><input id="text2" /></td>
										</tr>
										<tr>
											<td><strong>姓名：</strong></td>
											<td><input id="text3" /></td>
										</tr>
										<tr>
											<td><strong>性别:</strong></td>
											<td><input id="text4" /></td>
										</tr>
										<tr>
											<td><strong>出生日期:</strong></td>
											<td><input id="text5" type="date" /></td>
										</tr>
										<tr>
											<td><strong>预退休日期:</strong></td>
											<td><input id="text6" type="date" /></td>
										</tr>
										<tr>
											<td><strong>实际退休日期:</strong></td>
											<td><input id="text7" type="date" /></td>
										</tr>
										<tr>
											<td><strong>特殊工种:</strong></td>
											<td><input id="text8" /></td>
										</tr>
										<tr>
											<td><strong>女管理岗位:</strong></td>
											<td><input id="text9" /></td>
										</tr>
										<tr>
											<td><strong>职称：</strong></td>
											<td><input id="text10" /></td>
										</tr>
										<tr>
											<td><strong>工龄：</strong></td>
											<td><input id="text11" /></td>
										</tr>
									</table>

								</div>
							</div>
						</h3>
					</div>
					<div class="container">
						<h3>
							<div class="row">
								<div class="col-md-1">
									<button id="update" class="btn btn-primary btn-block">修改</button>
								</div>
							</div>
						</h3>
					</div>
				</div>
			</div>
			<div role="tabpanel" class="tab-pane" id="profile">
		<div class="row" id="profile1">
		</div>
			</div>
			<div role="tabpanel" class="tab-pane" id="messages">
				<form id="form" action="" method="post"
					enctype="multipart/form-data">
					<input type="file" name="file" />
					<button type="submit">上传</button>
				</form>
			</div>
		</div>
	</div>
</body>
<script id="template" type="text/x-handlebars-template">
    {{#each item}}
    <div class="col-md-3">
		<div class="thumbnail">
			<a href="photo_del.html?id={{id}}"><img src="upload/{{archive_id}}/{{name}}" /></a>
		</div>
    </div>
    {{/each}}
  </script>
<script type="text/javascript">
	$(function() {
		var id = getQueryString('id');
		var url = 'queryOne.action?id=' + id;
		$('#form').attr('action', id + '/upload.action'),
		$.getJSON(url, function(res) {
			$('#text1').val(res.archive_id);
			$('#text2').val(res.identity);
			$('#text3').val(res.name);
			$('#text4').val(res.gender);
			$('#text5').val(res.birthday);
			$('#text6').val(res.date_retire1);
			$('#text7').val(res.date_retire2);
			$('#text8').val(res.sp);
			$('#text9').val(res.fc);
			$('#text10').val(res.title);
			$('#text11').val(res.seniority);
		})
			$.getJSON('query_file.action?id='+id, 
			function(res) {
				console.log(res);
				  var data={'item':res};
			        var t=Handlebars.compile($('#template').html());
			        $('#profile1').html(t(data));
				})

		$('#update').click(function() {
			$.post('update.action?id=' + id, {
				archive_id : $('#text1').val(),
				identity : $('#text2').val(),
				name : $('#text3').val(),
				gender : $('#text4').val(),
				birthday : $('#text5').val(),
				date_retire1 : $('#text6').val(),
				date_retire2 : $('#text7').val(),
				sp : $('#text8').val(),
				fc : $('#text9').val(),
				title : $('#text10').val(),
				seniority : $('#text11').val()
			}, function(res, status) {
				if ("OK" == res) {
					alert('修改成功');
				}
			})

		})
	})
</script>
